﻿@model ZDSoft.LMS.Domain.User

@{
   Layout = null;//不引用母模板
}
<html>
<head>
    <title>物流业务支撑系统 - 重庆广展物流有限公司</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Style/Login.css")" rel="stylesheet" type="text/css" />
</head>
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
@*<script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>*@
<script src="@Url.Content("~/Scripts/JQuery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.simplemodal.1.4.1.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function CheckPage() {//判断用户名是否为空
        var loginName = $("#account").val();//获取用户输入的用户名
        loginName = $.trim(loginName);
        if (loginName.length < 1) {
            alert("用户名不能为空!");
            $("#account").focus();
            return false;
        }

        //判断密码是否为空
        var pwd = $("#password").val();//获取用户输入的密码
        pwd = $.trim(pwd);
        if (pwd.length < 1) {
            alert("密码不能为空!");
            $("#password").focus();
            return false;
        }
        return true;
    }

    function OnFailure(result) {
        alert("系统错误,无法登录，请与管理员联系!\n" + result.responseText);
    }

    function OnAJAXBegin() {
        if (CheckPage()) {//如果输入了用户名和密码
            //在AJAX调用Login方法期间弹出一个模态的对话框
            $.modal("<img src='@Url.Content("~/Content/Images/loading.gif")' alt=''></img>");    
        }
    }

    function OnComplete(result) {
        $.modal.close();//关闭弹出的模态对话框
        var returnValue = result.get_data(); //获取UserController中Login方法返回的结果
        if (returnValue == "0") {//如果返回结果是“0”说明“用户名或密码错误”
            alert("用户名或密码错误!");
        }
        else {
            window.location = returnValue; //否则跳转到Login方法返回的页面
        }
    }
</script>
<body>
    <center>
        <div class="divMain">
            <div>
                <img src="@Url.Content("~/Content/Images/Login/Logo.jpg")" alt="" /><img src="@Url.Content("~/Content/Images/Login/SystemLogo.jpg")" alt="" /></div>
            <div>
                <img src="@Url.Content("~/Content/Images/Login/l_03.jpg")" alt="" /><img src="@Url.Content("~/Content/Images/Login/l_04.jpg")" alt="" /></div>
            <div class="divLoginArea">
                <div class="divMain000">
                    <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
                        height="120" width="120" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
                        <param name="Movie" value="@Url.Content("~/Content/Images/Login/star.swf")"/>
                        <param name="Src" value="@Url.Content("~/Content/Images/Login/star.swf")"/>
                        <param name="WMode" value="Transparent" />
                        <embed src="@Url.Content("~/Content/Image/Login/star.swf")" width="120" height="120" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
                        type="application/x-shockwave-flash" wmode="transparent" />
                    </object>
                </div>
                <div class="divAccount">
                    <div class="divInput">@* @using (Ajax.BeginForm("Login", "", new AjaxOptions { OnBegin = "OnAJAXBegin", OnComplete = "OnComplete", OnFailure = "OnFailure"}))*@
                    @using(Html.BeginForm())                       
                        { 
                            <div class="divLoginLine">
                                <span>用户名：</span>@Html.TextBox("account", "sa", new { @class = "textBox" })<br />
                            </div>
                            <div class="divLoginLine">
                                <span>密&nbsp;&nbsp;&nbsp;&nbsp;码：</span>@Html.Password("password", "123", new { @class = "textBox" })
                            </div>
                            <div class="divButton divLoginLine">
                                <div id="divAjax">
                                    <input type="submit" id="btnLogin" class="btn3" value="登录" />
                                </div>
                                <div id="lblError" class="divNotice">
                                </div>
                            </div>
                        }
                    </div>
                </div>
                <div class="divPassword">
                </div>
            </div>
            <div class="divBottom">
                <div class="divWords">
                    Copyright © 2011 - 2012 重庆正大软件职业技术学院 .All Rights Reserved.
                </div>
            </div>
        </div>
    </center>
    <script language="javascript">
      @{
        if(ViewBag.ErrorMsg != null)
        {
            @:alert('@ViewBag.ErrorMsg');
        }
      }

      $("#imgSub").click(function(){
          //方法1：$("form").eq(0).submit();
          //方法2
          $("#btnLogin").click();
      });

    </script>
</body>
</html>
